import {
  createRouter,
  createWebHashHistory,
  RouteRecordRaw
} from 'vue-router'

import Home from '@/views/Home.vue'
import List from '@/views/List.vue'
import Detail from '@/views/Detail.vue'
import History from '@/views/History.vue'
import Collection from '@/views/Collection.vue'
import Rule from '@/views/Rule.vue'
import Test from '@/views/Test.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: Home,
    meta: { title: '首页'}
  },
  {
    path: '/list',
    name: 'list',
    component: List,
    meta: { title: '搜索列表'}
  },
  {
    path: '/detail',
    name: 'detail',
    component: Detail,
    meta: { title: '详情'}
  },
  {
    path: '/history',
    name: 'history',
    component: History,
    meta: { title: '历史记录'}
  },
  {
    path: '/collection',
    name: 'collection',
    component: Collection,
    meta: { title: '收藏'}
  },
  {
    path: '/rule',
    name: 'rule',
    component: Rule,
    meta: { title: '规则'}
  },
  {
    path: '/test',
    name: 'test',
    component: Test,
    meta: { title: '测试'}
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router